using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using eShop.Business;

using ECommerce.Library.Web;
using System.Collections.Generic;
using ECommerce.Library;
using System.IO;
using Ext.Net;


public partial class admin_newsletter_archive : SiteAdminBasePage
{
    private bool _useSearch
    {
        get
        {
            if (Session["_useSearch"] == null)
                return false;
            else return Convert.ToBoolean(Session["_useSearch"]);
        }
        set
        {
            Session["_useSearch"] = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!X.IsAjaxRequest)
        {
            Session["_useSearch"] = null;
        }
    }

    protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
    {
        BindOrders(e.Sort + (e.Dir.ToString() == "Default" ? "" : " " + e.Dir), e.Start, e.Limit);
    }

    private void BindOrders(string sort, int start, int limit)
    {
        List<Newsletter> data = null;
        int totalCount = 0;

        data = Newsletter.Newsletters(sort, start, limit, false);
        totalCount = Newsletter.TotalNewsletterCount();

        Store1.DataSource = data;
        Store1.DataBind();

        (Store1.Proxy[0] as PageProxy).Total = totalCount;
    }

}
